﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using IHISCETeim.BLL;
using IHISCETeim.Library;
using IHISCETeim.Model;
using System.Data;
using System.Text;

namespace IHISCETeim.Web.AgentSys.SvrMgr
{
    public partial class UAgentMacNewOut : PageBase
    {
        protected override Permission[] PowerKey
        {
            get
            {
                return new Permission[] { Permission.修改, Permission.新增 };
            }
        }
        protected override string DWZRef
        {
            get
            {
                return "UAgentMacList";
            }

        }
        /// <summary>
        /// 操作类型,ADD,UPDATE
        /// </summary>
        protected string Action
        {
            get
            {
                return GetRequestValue<string>("action", "add");
            }
        }
        protected int UASID
        {
            get
            {
                return GetRequestValue<int>("UASID", 0);
            }
        }

        private UAgentMacStockInfo _UAgentMacStock = null;
        protected UAgentMacStockInfo UAgentMacStockObj
        {
            get
            {
                if (_UAgentMacStock == null)
                    _UAgentMacStock = UAgentMacStockController.GetById(UASID);

                return _UAgentMacStock == null ? new UAgentMacStockInfo() { IntoStockDate = "", MacType = "", AgentName = HasPower(Permission.经销商平台_经销商) ? base.User.Department : "" } : _UAgentMacStock;
            }
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            if (GetRequestValue<string>("ajaxmethod", "") == "add")
            {
                addmenu();
            }
        }

        private void addmenu()
        {

           
           bool state = GetRequestValue<bool>("State",false);
            string outdate= GetRequestValue<string>("OutDate", DateTime.Now.ToString("yyyy-MM-dd"));
            bool x = UAgentMacStockController.UAgentMacStock_UpdateOut(UASID, state, outdate);
            if (x )
            {
                SuccessAlertJson("转出成功");
                
                return;
            }
            ErrorJson("转出失败");

        }
    }
}